<!DOCTYPE html>
<html>

	<head>
		<meta charset="utf-8" />
		<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
		<title>订单管理</title>
		<link rel="stylesheet" href="__AGENT__/css/iconfont.css" />
		<link rel="stylesheet" href="__AGENT__/css/css.css" />
	</head>

	<body>
		{include file="public/header" /}
		<div class="index_conbox">
			<div class="index_content clearfix">
				{include file="public/lefter" /}
				<div class="right">
					<div class="rigtop">
						<span class="title">订单管理</span>
					</div>
					<div class="indrig_con orders_con">
						<div class="orders_topbox clearfix">
							<form id="my_form" action="{:url('agent/shop/goods_order')}" method="post">
							<div class="chax_rowbox clearfix">
								<div class="shxx_row clearfix">
						            <div class="left">订单编号：</div>
						            <div class="right clearfix">
										<input id="sn" type="text" name="sn" placeholder="" class="chax_input" />
						            </div>
						        </div>
						        <div class="shxx_row clearfix">
						            <div class="left">订单状态：</div>
						            <div class="right clearfix">
						                <div id="htselect">
											<select id="status" name="status">
												<option value="0">全部订单</option>
												<option value="1">待付款</option>
												<option value="4">待确认</option>
												<option value="5">待评价</option>
											</select>
										</div>
						            </div>
						            <button type="submit" class="htcxbtn">查询</button>
						        </div>
							</div>
							</form>
						</div>
						<div class="orders_content">
							{foreach name="list" item="o" empty="暂无订单"}
							<table class="zizh_table1">
								<thead>
									<tr class="special">
										<th colspan="11">
											<span>订单号：{$o.sn}</span>
											<span>备注：{$o.message}</span>
										</th>
									</tr>
									<tr>
										<th style="width:8%;">联系人</th>
										<th style="width:10%;"> 商品名称</th>
										<th  style="width:8%;">订单金额</th>
										<th  style="width:8%;">实付金额</th>
										<th style="width:10%;">鼓励金赠送</th>
										<th style="width:10%;">鼓励金抵扣</th>
										<th style="width:15%;">下单时间</th>
										<th style="width:15%;">支付时间</th>
										<th style="width:10%;">订单状态</th>
										<th style="width:8%;">操作</th>
									</tr>
								</thead>
								<tbody id="tbody">
									<tr>
										<td>{$o.mobile}</td>
										<td >{$o.goods_name}</td>
										<td >{$o.total_price}</td>
										<td >{$o.pay_price}</td>
										<td >{$o.give_score}</td>
										<td >{$o.need_score}</td>
										<td >{$o.add_time}</td>
										<td >{$o.pay_time}</td>
										<td >{if $o.status==1}待付款
											{elseif $o.status==4}
											待消费
											{elseif $o.status==5}
											待评价
											{/if}</td>
										<td >
											{if $o.status==1}
											{elseif $o.status==4}
											<button class="htcxbtn" style="height: 25px;line-height: 25px;" onclick="confirm({$o.id})">确认消费</button>
											{elseif $o.status==5}
											{/if}
										</td>
									</tr>
								</tbody>
							</table>
							{/foreach}
							<div class="fenye" style="display: block;">
								{$list->render()}
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		
		{include file="public/footer" /}
	</body>

</html>
<script>
	{if condition="$sn!=0"}
	$("#sn").val('{$sn}');
	{/if}
	{if condition="$status!=0"}
	$("#status").val('{$status}');
	{/if}
/*OEM-删除公告*/
function confirm(id) {
	layer.confirm('确认核销此订单？', {
		btn: ['确定', '取消'] //按钮
	}, function() {
		$.ajax({
			type: 'get',
			url: "{:url('confirm')}",
			dataType: 'json',
			data: {
				id: id
			},
			success: function(data) {
				if(data.code == 200) {
					layer.msg(data.msg, {
						icon: 1,
						time: 1000
					});
					location.reload();
				} else {
					layer.msg(data.msg, {
						icon: 1,
						time: 1000
					});
				}
			},
			error: function(data) {
				console.log(data.msg);
			}
		});
	});
}
function notice_add() {
	layer.open({
	  type: 2,
	  title: '发布公告',
	  shadeClose: true,
	  shade: 0.8,
	  area: ['450px', '340px'],
	  content: "{:url('helps/notice_add')}"
	}); 
}

</script>